using SilverSea.Untilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public sealed class frmSummaryReports : Form
{
	private IContainer icontainer_0;
	private ToolStrip toolStrip2;
	private ToolStripButton btnRefesh;
	private ToolStripSeparator toolStripSeparator1;
	private ToolStripButton btnExport;
	private ToolStripSeparator toolStripSeparator3;
	private ToolStripButton btnPrintPreview;
	private ToolStripSeparator toolStripSeparator5;
	private ToolStripButton btnClose;
	private DataGridView dataGridView;
	private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
	private DataGridViewTextBoxColumn DateMonth;
	private DataGridViewTextBoxColumn CarColumn;
	private DataGridViewTextBoxColumn MotoColumn;
	private DataGridViewTextBoxColumn SumColumn;
	private Panel panel1;
	private GroupBox groupBox1;
	private ComboBox cbxYear;
	private Label labelYear;
	private ComboBox cbxMonth;
	private Label labelMonth;
	private DateTimePicker dtpDateFrom;
	private DateTimePicker dtpDateTo;
	private Label labelDateTo;
	private Label labelDateFrom;
	private ComboBox cbxReportType;
	private Label label1;
	private Button btnRunReport;
	private string string_0 = string.Empty;
	private string string_1 = string.Empty;
	private System.DateTime dateTime_0 = System.DateTime.Now;
	private System.DateTime dateTime_1 = System.DateTime.Now;
	public frmSummaryReports()
	{
		this.InitializeComponent();
		this.cbxReportType.SelectedIndex = 0;
		this.cbxMonth.SelectedIndex = System.DateTime.Now.Month - 1;
		this.cbxYear.Items.Add(System.DateTime.Now.Year);
		this.cbxYear.Items.Add(System.DateTime.Now.AddYears(-1).Year);
		this.cbxYear.Items.Add(System.DateTime.Now.AddYears(-2).Year);
		this.cbxYear.Items.Add(System.DateTime.Now.AddYears(-3).Year);
		this.cbxYear.SelectedIndex = 0;
		ExportDGV.CompanyName = MainForm.SystemConfiguration_0.string_12;
		ExportDGV.CompanyAddress = MainForm.SystemConfiguration_0.string_11;
		PrintDGV.CompanyName = MainForm.SystemConfiguration_0.string_12;
		PrintDGV.CompanyAddress = MainForm.SystemConfiguration_0.string_11;
		PrintLPRInfo.DepartmentManagement = MainForm.SystemConfiguration_0.string_14;
		PrintLPRInfo.ViolationDescriptionDetails = MainForm.SystemConfiguration_0.string_13;
		PrintLPRInfo.LocationDetails = MainForm.SystemConfiguration_0.string_11;
		PrintLPRInfo.PersonManegementDetails = RegisterationInfo.gclass2_0.method_2();
		PrintLPRInfo.ColumnHeaders = new System.Collections.Generic.List<string>
		{
			"NGÀY",
			"GIỜ",
			"BIỂN SỐ"
		};
	}
	protected override void Dispose(bool disposing)
	{
		if (disposing && this.icontainer_0 != null)
		{
			this.icontainer_0.Dispose();
		}
		base.Dispose(disposing);
	}
	private void InitializeComponent()
	{
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSummaryReports));
        this.toolStrip2 = new System.Windows.Forms.ToolStrip();
        this.btnRefesh = new System.Windows.Forms.ToolStripButton();
        this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
        this.btnExport = new System.Windows.Forms.ToolStripButton();
        this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
        this.btnPrintPreview = new System.Windows.Forms.ToolStripButton();
        this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
        this.btnClose = new System.Windows.Forms.ToolStripButton();
        this.dataGridView = new System.Windows.Forms.DataGridView();
        this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.DateMonth = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.CarColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.MotoColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.SumColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
        this.panel1 = new System.Windows.Forms.Panel();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.btnRunReport = new System.Windows.Forms.Button();
        this.cbxYear = new System.Windows.Forms.ComboBox();
        this.labelYear = new System.Windows.Forms.Label();
        this.cbxMonth = new System.Windows.Forms.ComboBox();
        this.labelMonth = new System.Windows.Forms.Label();
        this.dtpDateFrom = new System.Windows.Forms.DateTimePicker();
        this.dtpDateTo = new System.Windows.Forms.DateTimePicker();
        this.labelDateTo = new System.Windows.Forms.Label();
        this.labelDateFrom = new System.Windows.Forms.Label();
        this.cbxReportType = new System.Windows.Forms.ComboBox();
        this.label1 = new System.Windows.Forms.Label();
        this.toolStrip2.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
        this.panel1.SuspendLayout();
        this.groupBox1.SuspendLayout();
        this.SuspendLayout();
        // 
        // toolStrip2
        // 
        resources.ApplyResources(this.toolStrip2, "toolStrip2");
        this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.btnRefesh,
            this.toolStripSeparator1,
            this.btnExport,
            this.toolStripSeparator3,
            this.btnPrintPreview,
            this.toolStripSeparator5,
            this.btnClose});
        this.toolStrip2.Name = "toolStrip2";
        // 
        // btnRefesh
        // 
        resources.ApplyResources(this.btnRefesh, "btnRefesh");
        this.btnRefesh.Name = "btnRefesh";
        this.btnRefesh.Click += new System.EventHandler(this.btnRunReport_Click);
        // 
        // toolStripSeparator1
        // 
        this.toolStripSeparator1.Name = "toolStripSeparator1";
        resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
        // 
        // btnExport
        // 
        resources.ApplyResources(this.btnExport, "btnExport");
        this.btnExport.Name = "btnExport";
        this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
        // 
        // toolStripSeparator3
        // 
        this.toolStripSeparator3.Name = "toolStripSeparator3";
        resources.ApplyResources(this.toolStripSeparator3, "toolStripSeparator3");
        // 
        // btnPrintPreview
        // 
        resources.ApplyResources(this.btnPrintPreview, "btnPrintPreview");
        this.btnPrintPreview.Name = "btnPrintPreview";
        this.btnPrintPreview.Click += new System.EventHandler(this.btnPrintPreview_Click);
        // 
        // toolStripSeparator5
        // 
        this.toolStripSeparator5.Name = "toolStripSeparator5";
        resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
        // 
        // btnClose
        // 
        resources.ApplyResources(this.btnClose, "btnClose");
        this.btnClose.Name = "btnClose";
        this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
        // 
        // dataGridView
        // 
        this.dataGridView.AllowUserToAddRows = false;
        this.dataGridView.AllowUserToDeleteRows = false;
        this.dataGridView.AllowUserToResizeRows = false;
        this.dataGridView.BackgroundColor = System.Drawing.Color.White;
        resources.ApplyResources(this.dataGridView, "dataGridView");
        this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
        this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.dataGridViewTextBoxColumn1,
            this.DateMonth,
            this.CarColumn,
            this.MotoColumn,
            this.SumColumn});
        this.dataGridView.EnableHeadersVisualStyles = false;
        this.dataGridView.Name = "dataGridView";
        this.dataGridView.ReadOnly = true;
        this.dataGridView.RowHeadersVisible = false;
        this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
        // 
        // dataGridViewTextBoxColumn1
        // 
        resources.ApplyResources(this.dataGridViewTextBoxColumn1, "dataGridViewTextBoxColumn1");
        this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
        this.dataGridViewTextBoxColumn1.ReadOnly = true;
        // 
        // DateMonth
        // 
        resources.ApplyResources(this.DateMonth, "DateMonth");
        this.DateMonth.Name = "DateMonth";
        this.DateMonth.ReadOnly = true;
        // 
        // CarColumn
        // 
        resources.ApplyResources(this.CarColumn, "CarColumn");
        this.CarColumn.Name = "CarColumn";
        this.CarColumn.ReadOnly = true;
        // 
        // MotoColumn
        // 
        resources.ApplyResources(this.MotoColumn, "MotoColumn");
        this.MotoColumn.Name = "MotoColumn";
        this.MotoColumn.ReadOnly = true;
        // 
        // SumColumn
        // 
        resources.ApplyResources(this.SumColumn, "SumColumn");
        this.SumColumn.Name = "SumColumn";
        this.SumColumn.ReadOnly = true;
        // 
        // panel1
        // 
        this.panel1.Controls.Add(this.groupBox1);
        resources.ApplyResources(this.panel1, "panel1");
        this.panel1.Name = "panel1";
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.btnRunReport);
        this.groupBox1.Controls.Add(this.cbxYear);
        this.groupBox1.Controls.Add(this.labelYear);
        this.groupBox1.Controls.Add(this.cbxMonth);
        this.groupBox1.Controls.Add(this.labelMonth);
        this.groupBox1.Controls.Add(this.dtpDateFrom);
        this.groupBox1.Controls.Add(this.dtpDateTo);
        this.groupBox1.Controls.Add(this.labelDateTo);
        this.groupBox1.Controls.Add(this.labelDateFrom);
        this.groupBox1.Controls.Add(this.cbxReportType);
        this.groupBox1.Controls.Add(this.label1);
        resources.ApplyResources(this.groupBox1, "groupBox1");
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.TabStop = false;
        // 
        // btnRunReport
        // 
        resources.ApplyResources(this.btnRunReport, "btnRunReport");
        this.btnRunReport.Name = "btnRunReport";
        this.btnRunReport.UseVisualStyleBackColor = true;
        this.btnRunReport.Click += new System.EventHandler(this.btnRunReport_Click);
        // 
        // cbxYear
        // 
        this.cbxYear.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cbxYear.FormattingEnabled = true;
        resources.ApplyResources(this.cbxYear, "cbxYear");
        this.cbxYear.Name = "cbxYear";
        // 
        // labelYear
        // 
        resources.ApplyResources(this.labelYear, "labelYear");
        this.labelYear.Name = "labelYear";
        // 
        // cbxMonth
        // 
        this.cbxMonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cbxMonth.FormattingEnabled = true;
        this.cbxMonth.Items.AddRange(new object[] {
            resources.GetString("cbxMonth.Items"),
            resources.GetString("cbxMonth.Items1"),
            resources.GetString("cbxMonth.Items2"),
            resources.GetString("cbxMonth.Items3"),
            resources.GetString("cbxMonth.Items4"),
            resources.GetString("cbxMonth.Items5"),
            resources.GetString("cbxMonth.Items6"),
            resources.GetString("cbxMonth.Items7"),
            resources.GetString("cbxMonth.Items8"),
            resources.GetString("cbxMonth.Items9"),
            resources.GetString("cbxMonth.Items10"),
            resources.GetString("cbxMonth.Items11")});
        resources.ApplyResources(this.cbxMonth, "cbxMonth");
        this.cbxMonth.Name = "cbxMonth";
        // 
        // labelMonth
        // 
        resources.ApplyResources(this.labelMonth, "labelMonth");
        this.labelMonth.Name = "labelMonth";
        // 
        // dtpDateFrom
        // 
        resources.ApplyResources(this.dtpDateFrom, "dtpDateFrom");
        this.dtpDateFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
        this.dtpDateFrom.Name = "dtpDateFrom";
        // 
        // dtpDateTo
        // 
        resources.ApplyResources(this.dtpDateTo, "dtpDateTo");
        this.dtpDateTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
        this.dtpDateTo.Name = "dtpDateTo";
        // 
        // labelDateTo
        // 
        resources.ApplyResources(this.labelDateTo, "labelDateTo");
        this.labelDateTo.Name = "labelDateTo";
        // 
        // labelDateFrom
        // 
        resources.ApplyResources(this.labelDateFrom, "labelDateFrom");
        this.labelDateFrom.Name = "labelDateFrom";
        // 
        // cbxReportType
        // 
        this.cbxReportType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.cbxReportType.FormattingEnabled = true;
        this.cbxReportType.Items.AddRange(new object[] {
            resources.GetString("cbxReportType.Items"),
            resources.GetString("cbxReportType.Items1"),
            resources.GetString("cbxReportType.Items2")});
        resources.ApplyResources(this.cbxReportType, "cbxReportType");
        this.cbxReportType.Name = "cbxReportType";
        this.cbxReportType.SelectedIndexChanged += new System.EventHandler(this.cbxReportType_SelectedIndexChanged);
        // 
        // label1
        // 
        resources.ApplyResources(this.label1, "label1");
        this.label1.Name = "label1";
        // 
        // frmSummaryReports
        // 
        resources.ApplyResources(this, "$this");
        this.Controls.Add(this.dataGridView);
        this.Controls.Add(this.panel1);
        this.Controls.Add(this.toolStrip2);
        this.Name = "frmSummaryReports";
        this.Load += new System.EventHandler(this.frmSummaryReports_Load);
        this.toolStrip2.ResumeLayout(false);
        this.toolStrip2.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
        this.panel1.ResumeLayout(false);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.ResumeLayout(false);
        this.PerformLayout();

	}
	private void btnPrintPreview_Click(object sender, System.EventArgs e)
	{
		PrintDGV.PrintTitle = "THỐNG KÊ VI PHẠM";
		PrintDGV.PrintTitleDetail1 = this.string_0;
		PrintDGV.PrintTitleDetail2 = this.string_1;
		PrintDGV.IsLandscape = true;
		PrintDGV.FitToPageWidth = true;
		PrintDGV.HeaderHeight = 50;
		PrintDGV.DisplayPrintOption = false;
		PrintDGV.Print(this.dataGridView);
	}
	private void btnExport_Click(object sender, System.EventArgs e)
	{
		ExportDGV.PrintTitle = "THỐNG KÊ VI PHẠM";
		ExportDGV.PrintTitleDetail1 = this.string_0;
		ExportDGV.PrintTitleDetail2 = this.string_1;
		ExportDGV.IsLanscape = false;
		ExportDGV.HeaderHeight = 50;
		ExportDGV.DisplayPrintOption = false;
		ExportDGV.FastExport = true;
		ExportDGV.Export(this.dataGridView);
	}
	private void frmSummaryReports_Load(object sender, System.EventArgs e)
	{
		this.cbxReportType.SelectedIndex = 0;
	}
	private void btnClose_Click(object sender, System.EventArgs e)
	{
		base.Close();
	}
	private void btnRunReport_Click(object sender, System.EventArgs e)
	{
		string string_ = string.Empty;
		if (this.cbxReportType.SelectedIndex == 0)
		{
			System.DateTime dateTime = System.Convert.ToDateTime(this.dtpDateFrom.Value.ToString("yyyy/MM/dd") + " 00:00:00");
			System.DateTime dateTime2 = System.Convert.ToDateTime(this.dtpDateTo.Value.ToString("yyyy/MM/dd") + " 23:59:59");
			string_ = string.Concat(new object[]
			{
				"where CheckDelete = ",
				false,
				" and EventDateTime >= #",
				dateTime,
				"# and EventDateTime <= #",
				dateTime2,
				"#"
			});
			Splash.Show();
			MainForm.SystemConfiguration_0.method_38(this.dataGridView, string_, dateTime, dateTime2);
			Splash.Hide();
		}
		else
		{
			if (this.cbxReportType.SelectedIndex == 1)
			{
				int month = (int)System.Convert.ToInt16(this.cbxMonth.Text);
				int year = System.Convert.ToInt32(this.cbxYear.Text);
				this.dateTime_0 = new System.DateTime(year, month, 1, 0, 0, 0);
				this.dateTime_1 = new System.DateTime(year, month, 1, 23, 59, 59);
				this.dateTime_1 = this.dateTime_1.AddMonths(1).AddDays(-1.0);
				string_ = string.Concat(new object[]
				{
					"where CheckDelete = ",
					false,
					" and EventDateTime >= #",
					this.dateTime_0,
					"# and EventDateTime <= #",
					this.dateTime_1,
					"#"
				});
				Splash.Show();
				MainForm.SystemConfiguration_0.method_38(this.dataGridView, string_, this.dateTime_0, this.dateTime_1);
				Splash.Hide();
			}
			else
			{
				if (this.cbxReportType.SelectedIndex == 2)
				{
					int year2 = (int)System.Convert.ToInt16(this.cbxYear.Text);
					this.dataGridView.Rows.Clear();
					int num = 0;
					int num2 = 0;
					int num3 = 0;
					Splash.Show();
					for (int i = 1; i < 13; i++)
					{
						this.dateTime_0 = new System.DateTime(year2, i, 1, 0, 0, 0);
						this.dateTime_1 = new System.DateTime(year2, i, 1, 23, 59, 59);
						this.dateTime_1 = this.dateTime_1.AddMonths(1).AddDays(-1.0);
						string_ = string.Concat(new object[]
						{
							"where CheckDelete = ",
							false,
							" and EventDateTime >= #",
							this.dateTime_0,
							"# and EventDateTime <= #",
							this.dateTime_1,
							"#"
						});
						MainForm.SystemConfiguration_0.method_39(this.dataGridView, string_, this.dateTime_0, i, ref num, ref num2, ref num3);
					}
					this.dataGridView.Rows.Add(new object[]
					{
						"Tổng",
						"Năm " + year2.ToString(),
						num2.ToString(),
						num.ToString(),
						num3.ToString()
					});
					Splash.Hide();
				}
			}
		}
		if (this.cbxReportType.SelectedIndex == 0)
		{
			this.string_0 = "Từ ngày " + this.dateTime_0.ToString("dd/MM/yyyy") + " đến ngày " + this.dateTime_1.ToString("dd/MM/yyyy");
		}
		if (this.cbxReportType.SelectedIndex == 1)
		{
			this.string_0 = "Tháng " + this.cbxMonth.Text + " năm " + this.cbxYear.Text;
		}
		if (this.cbxReportType.SelectedIndex == 2)
		{
			this.string_0 = "Năm " + this.cbxYear.Text;
		}
		this.btnExport.Enabled = (this.btnPrintPreview.Enabled = (this.dataGridView.RowCount > 0));
	}
	private void cbxReportType_SelectedIndexChanged(object sender, System.EventArgs e)
	{
		if (this.cbxReportType.SelectedIndex == 0)
		{
			this.labelDateFrom.Enabled = true;
			this.dtpDateFrom.Enabled = true;
			this.labelDateTo.Enabled = true;
			this.dtpDateTo.Enabled = true;
			this.labelMonth.Enabled = false;
			this.cbxMonth.Enabled = false;
			this.labelYear.Enabled = false;
			this.cbxYear.Enabled = false;
			return;
		}
		if (this.cbxReportType.SelectedIndex == 1)
		{
			this.labelDateFrom.Enabled = false;
			this.dtpDateFrom.Enabled = false;
			this.labelDateTo.Enabled = false;
			this.dtpDateTo.Enabled = false;
			this.labelMonth.Enabled = true;
			this.cbxMonth.Enabled = true;
			this.labelYear.Enabled = true;
			this.cbxYear.Enabled = true;
			return;
		}
		if (this.cbxReportType.SelectedIndex == 2)
		{
			this.labelDateFrom.Enabled = false;
			this.dtpDateFrom.Enabled = false;
			this.labelDateTo.Enabled = false;
			this.dtpDateTo.Enabled = false;
			this.labelMonth.Enabled = false;
			this.cbxMonth.Enabled = false;
			this.labelYear.Enabled = true;
			this.cbxYear.Enabled = true;
		}
	}
}
